package com.oa.office.dao;

import org.apache.ibatis.jdbc.SQL;

import com.oa.office.entity.HeadRoutingWithBLOBs;

public class HeadRoutingSqlProvider {

    public String insertSelective(HeadRoutingWithBLOBs record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("head_routing");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getHeadName() != null) {
            sql.VALUES("head_name", "#{headName,jdbcType=VARCHAR}");
        }
        
        if (record.getDay() != null) {
            sql.VALUES("day", "#{day,jdbcType=TIMESTAMP}");
        }
        
        if (record.getWeek() != null) {
            sql.VALUES("week", "#{week,jdbcType=CHAR}");
        }
        
        if (record.getCreater() != null) {
            sql.VALUES("creater", "#{creater,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdater() != null) {
            sql.VALUES("updater", "#{updater,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.VALUES("updatetime", "#{updatetime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getState() != null) {
            sql.VALUES("state", "#{state,jdbcType=INTEGER}");
        }
        
        if (record.getSpar() != null) {
            sql.VALUES("spar", "#{spar,jdbcType=VARCHAR}");
        }
        
        if (record.getRouting() != null) {
            sql.VALUES("routing", "#{routing,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getOther() != null) {
            sql.VALUES("other", "#{other,jdbcType=LONGVARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(HeadRoutingWithBLOBs record) {
        SQL sql = new SQL();
        sql.UPDATE("head_routing");
        
        if (record.getHeadName() != null) {
            sql.SET("head_name = #{headName,jdbcType=VARCHAR}");
        }
        
        if (record.getDay() != null) {
            sql.SET("day = #{day,jdbcType=TIMESTAMP}");
        }
        
        if (record.getWeek() != null) {
            sql.SET("week = #{week,jdbcType=CHAR}");
        }
        
        if (record.getCreater() != null) {
            sql.SET("creater = #{creater,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdater() != null) {
            sql.SET("updater = #{updater,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.SET("updatetime = #{updatetime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getState() != null) {
            sql.SET("state = #{state,jdbcType=INTEGER}");
        }
        
        if (record.getSpar() != null) {
            sql.SET("spar = #{spar,jdbcType=VARCHAR}");
        }
        
        if (record.getRouting() != null) {
            sql.SET("routing = #{routing,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getOther() != null) {
            sql.SET("other = #{other,jdbcType=LONGVARCHAR}");
        }
        
        sql.WHERE("id = #{id,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}